package com.edais.domain.gift;


import com.edais.domain.User;

import java.util.Date;

public class PointAccount {
    private Long id;

    private Long userId;

    private String userName;

    private String userMobile;

    private Integer totalAmount;

    private Integer usedAmount;

    private String createPer;

    private Date createTime;

    private String updatePer;

    private Date updateTime;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Long getUserId() {
        return userId;
    }

    public void setUserId(Long userId) {
        this.userId = userId;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName == null ? null : userName.trim();
    }

    public String getUserMobile() {
        return userMobile;
    }

    public void setUserMobile(String userMobile) {
        this.userMobile = userMobile == null ? null : userMobile.trim();
    }

    public Integer getTotalAmount() {
        return totalAmount;
    }

    public void setTotalAmount(Integer totalAmount) {
        this.totalAmount = totalAmount;
    }

    public Integer getUsedAmount() {
        return usedAmount;
    }

    public void setUsedAmount(Integer usedAmount) {
        this.usedAmount = usedAmount;
    }

    public String getCreatePer() {
        return createPer;
    }

    public void setCreatePer(String createPer) {
        this.createPer = createPer == null ? null : createPer.trim();
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public String getUpdatePer() {
        return updatePer;
    }

    public void setUpdatePer(String updatePer) {
        this.updatePer = updatePer == null ? null : updatePer.trim();
    }

    public Date getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }
    
    public PointAccount(User user) {
        this.userId = Long.valueOf(user.getId());
        this.userName = user.getNick_name();
        this.userMobile = user.getMobile();
        this.totalAmount = 0;
        this.usedAmount = 0;
        this.setCreatePer("shopservice");
        this.setCreateTime(new Date());
    }

    public void addTotalAmount(Integer amount){
        if(null == amount)
            return;
        this.totalAmount += amount;
    }
    
    public PointAccount(){
    	
    }
}